//
//  UIButton+Custom.m
//  XGT
//
//  Created by DemonLee on 15/5/28.
//  Copyright (c) 2015年 Demon. All rights reserved.
//

#import "UIButton+Custom.h"

@implementation UIButton (Custom)

+ (UIButton *)initWithFrame:(CGRect)frame backgrandColor:(UIColor *)backgrandColor titleColor:(UIColor *)color title:(NSString *)title titleFont:(CGFloat)font{
    UIButton *Btn = [UIButton buttonWithType:UIButtonTypeCustom];
    Btn.frame = frame;
    if (backgrandColor == nil) {
        Btn.backgroundColor = [UIColor clearColor];
    }else{
       [Btn setBackgroundColor:backgrandColor];       
    }
    
    [Btn setTitleColor:color forState:UIControlStateNormal];
    [Btn setTitle:title forState:UIControlStateNormal];
    Btn.titleLabel.font    = [UIFont systemFontOfSize: font];
//    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, Btn.frame.size.width, Btn.frame.size.height)];
//    label.backgroundColor = [UIColor clearColor];
//    label.text = title;
//    label.textAlignment = NSTextAlignmentCenter;
//    label.font = [UIFont systemFontOfSize:font];
//    label.textColor = color;
//    label.userInteractionEnabled = YES;
//    [Btn addSubview:label];
    
    
    return Btn;
}

@end
